package com.robot.mcp;

import com.robot.service.LangChainService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Collections;
import java.util.List;

/**
 * MCPOrchestrator - Main entry point for processing user queries
 * Simplified to use LangChainService directly
 */
@Component
public class MCPOrchestrator {
    
    private static final Logger logger = LoggerFactory.getLogger(MCPOrchestrator.class);
    
    @Autowired
    private LangChainService langChainService;
    
    /**
     * Process user input by delegating to LangChainService
     */
    public String process(String input) {
        try {
            return langChainService.processQuery(input);
        } catch (Exception e) {
            logger.error("处理输入时出错", e);
            return "处理您的请求时出现了问题，请稍后再试。";
        }
    }
    
    /**
     * Process chat queries via LangChainService
     */
    public String chat(String query) {
        try {
            return langChainService.chat(query);
        } catch (Exception e) {
            logger.error("处理聊天失败", e);
            return "聊天处理失败，请稍后再试。";
        }
    }
    
    /**
     * Returns an empty list as we're no longer using multiple agents
     */
    public List<MCPAgent> getAllAgents() {
        return Collections.emptyList();
    }
} 